// Programming_Scala/src/ch09/spawn-script.scala

import scala.concurrent.ops._
import scala.actors.Actor
import scala.actors.Actor._


object SpawnExample {

  def main( args: Array[ String ] ) {

    println( "this will run synchronously" )

    spawn {
      println( "this will run asynchronously" )
    }

val fussyActor = actor {
  loop {
    println( "loop" )
    receive {
      case s: String => println( "I got a String:  " + s )
      case i: Int => println( "I got an Int:  " + i )
      case _ => println( "I have no idea what I just got." )
    }
  }
}

  fussyActor ! "hi"
  fussyActor ! 7
  fussyActor ! 33.3
  fussyActor.exit()
  }
}
